package com.example.consumer.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class OrderService {

    /**
     * restTemplate 是一个简单的http客户端
     * 帮助我们发起http请求
     * */
    @Autowired
    private RestTemplate restTemplate;

    public String getOrder(){
        String productName =restTemplate.getForObject("http://localhost:8096/pro/one",String.class);
        return  "the product:" + productName+ "in order";
    }
}
